package com.example.moneybook.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.moneybook.dto.RepaymentDto;
import com.example.moneybook.dto.ResponseResult;
import com.example.moneybook.pojo.Borrow;

import java.util.List;

/**
 * @Author: 包
 * @Date: 2023/3/1 22:52
 * Description:
 */
public interface BorrowService extends IService<Borrow> {

    /**
     * 获取某个账户的借款记录
     * @param userId
     * @param accountId
     * @return
     */
    List<Borrow> borrowByAccount(String userId, int accountId);

    /**
     * 添加借款
     * @param borrow
     * @return
     */
    ResponseResult addBorrow(Borrow borrow, String accountName);

    /**
     * 获取某个用户的所有借出/借入账单
     * @param userId
     * @param state
     * @return
     */
    ResponseResult loadBorrowBill(String userId, int state);

    /**
     * 求和借出/借入金额
     * @param userId
     * @param state
     * @return
     */
    int sumBorrowMoney(String userId, int state);

    /**
     * 借入/借出 还款
     * @param repaymentDto
     * @return
     */
    ResponseResult repayment(RepaymentDto repaymentDto);
}
